package cn.itcast.user.controller;

import cn.itcast.user.config.PatternProperties;
import cn.itcast.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Slf4j
@RestController
@RequestMapping("user")
//@RefreshScope //方式1 热更新注解 哪个类需要热更新就在哪个类上弄
public class UsersController {
    @Autowired
    private UserService userService;

    @Value("${pattern.dataformat}")
    private String dataformat;
    @Autowired
    private PatternProperties patternProperties;

    @GetMapping("now")
    public String now() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(dataformat));
    }
}
